// 角色管理
import {
    ajaxPostBack,
    ajaxPost
} from '@/utils/data/request'

// 列表
export function list(params: any) {
    return ajaxPostBack("auth/role-list", params, {
        cookies: ['yard_sn']
    })
}

// 全部
export function all() {
    return list({ page: 1, per_page: 100 })
}

// 编辑
export function edit(params: any) {
    return ajaxPost("auth/role-edit", params, { successMessage: true, cookies: ['yard_sn'] })
}

// 新增
export function add(params: any) {
    return ajaxPost("auth/role-create", params, { successMessage: true, cookies: ['yard_sn'] })
}

// 删除
export function del({ role_sn }: any) {
    return ajaxPost("auth/role-delete", { role_sn }, { successMessage: true, cookies: ['yard_sn'] })
}

// 代理商菜单权限
export function agentMenu(params: any) {
    return ajaxPostBack("auth/agent-menu-list", params)
}

// 代理商给园区分配菜单权限 menu_scope: 2
export function agentParkMenu({ agent_sn }: any) {
    return ajaxPostBack("auth/agent-menu-list", { agent_sn, menu_scope: 2 })
}

// 园区创建角色的菜单
export function yardParkmenu() {
    return ajaxPostBack("auth/park-menu-list", { }, {
        cookies: ['yard_sn']
    })
}